package com.levi.servicelocatorparttern;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * @author shentong
 * @since 2023/1/20 19:01
 * 第二种方式，用spring的自动注入实现
 */
@Service
public class Client2 {

    @Autowired
    private Map<String, Parser> parserFatory;


    public void run(TypeEnum type) {
        parserFatory.get(type.toString()).parse();
    }


}
